<?php

include_once('logic/view/View.php');

class ListCommentsView extends View
{
    // admin
    function __construct()
    {
	parent::__construct("ADMINISTRATOR");
	$this->_xsl_template = 'template/listcomments_template.xsl';
	// comments element
	$this->_comments = $this->_root->appendChild($this->_xml_doc->createElement('comments'));
	// <comments>
	// ...
	// </comments>
    }
	function addComment($photoId,$commentText,$commentDate)
	{
		// <comment>
		//	 <id>$photoId</id>
		//	 <date>$commentDate</date>
		//   <text>$commentText</text>
		// </comment>
		$comment = $this->_xml_doc->createElement('comment');
		$this->_comments->appendChild($comment);
		
		$id_node = $comment->appendChild($this->_xml_doc->createElement('id'));
		$id_node->appendChild($this->_xml_doc->createTextNode($photoId));
		$date_node = $comment->appendChild($this->_xml_doc->createElement('date'));
		$date_node->appendChild($this->_xml_doc->createTextNode($commentDate));
		$text_node = $comment->appendChild($this->_xml_doc->createElement('text'));
		$text_node->appendChild($this->_xml_doc->createTextNode($commentText));

	}
}


?>
